<?php
/**
 * Base.php
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@mygem.org so we can send you a copy immediately.
 *
 * @copyright   Copyright (c) 2012, MyGem <info@mygem.org>
 * @package     MyGem
 */


class MyGem_Base
{

    public function __get($key)
    {
        $method = 'get' . ucfirst($key);
        if (method_exists($this, $method)) {
            return $this->$method();
        }
        $ret = NULL;
        if (isset($this->$key)) {
            $ret = $this->$key;
        }
        return $ret;
    }

    public function __set($key, $value)
    {
        $method = 'set' . ucfirst($key);
        if (method_exists($this,$method)) {
            $this->$method($value);
            return $this;
        }
        $this->$key = $value;
        return $this;
    }

    public function __isset($key)
    {
        return $this->__get($key);
    }

}

